import requests
from bs4 import BeautifulSoup
def get_db_headers():
    return {
        "User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/135.0.0.0 Safari/537.36",
        "Referer":"https://movie.douban.com/",
    }

# 发送HTTP请求
url = 'https://movie.douban.com/'
response = requests.get(url,headers=get_db_headers())

# 检查请求是否成功
if response.status_code == 200:
    # 解析HTML文档
    soup = BeautifulSoup(response.text, 'html.parser')
    #开始爬
    elements = soup.select('.billboard-bd a')
    #遍历解析
    for i in elements :
        print(i.text)
else:
    print(f"请求失败，状态码：{response.status_code}")